package thread.java20230113;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 10个线程对日期进行初始化
 */
public class Demo58 {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            int finalI = i;
            Runnable runnable = ()->{
                Date date = new Date(finalI * 1000);//2s
                System.out.println(dateFormat(date));
            };
            new Thread(runnable).start();
        }

    }

    private static String dateFormat(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
        return simpleDateFormat.format(date);//1990-01-01 12:23:56    12:23:56   12:23   1990-01-01
    }
}
